package cn.gson.springboot.model.service;

import cn.gson.springboot.model.dao.PaymentInvoiceDao;
import cn.gson.springboot.model.mapper.PaymentInvoiceMapper;
import cn.gson.springboot.model.pojos.PaymentInvoice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class PaymentInvoiceService {
    @Autowired
    PaymentInvoiceMapper payInvoiceMapper;
    @Autowired
    PaymentInvoiceDao payInvoiceDao;

    public List<PaymentInvoice> selectPaymentInvoice(Integer value, Integer num,String payDate){
        return payInvoiceMapper.selectPaymentInvoice(value,num,payDate);
    }

    public List<PaymentInvoice> selectPaymentInvoiceByPurId(Integer purId){
        return payInvoiceMapper.selectPaymentInvoiceByPurId(purId);
    }

    public List<PaymentInvoice> selectPaymentInvoicePastFutureThirty(){
        return payInvoiceMapper.selectPaymentInvoicePastFutureThirty();
    }

    @Transactional(transactionManager = "transactionManager")
    public void savePaymentInvoice(PaymentInvoice pay){
        payInvoiceDao.save(pay);
    }

    @Transactional(transactionManager = "transactionManager")
    public void deletePaymentInvoice(Integer payId){
        payInvoiceDao.deleteById(payId);
    }
}
